package com.personal.cuncunxing.module.home;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

/**
 * Description:
 * Created by kode on 2020/5/26.
 */
public abstract class BaseFragment extends Fragment {
    private static final String TAG = "BaseFragment";
    private View view;
    //Fragment的view加载完毕
    protected boolean isViewCreated;
    //Fragment对UI可见
    protected boolean isUIVisible;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (view == null) {
            view = inflater.inflate(setLayout(), container, false);
        }
        return view;
    }

    protected abstract int setLayout();

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
    }

    @Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
    }

    //懒加载
    protected abstract void lazyLoad();
}
